package com.mhy.book.app;

import com.mhy.book.mapper.BookMapper;
import com.mhy.book.service.BookService;

import org.springframework.context.*;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class BaseConfigMain {
    public static void main(String[] args) {
        ApplicationContext ioc = new ClassPathXmlApplicationContext("base_config.xml");
        BookMapper mapper = ioc.getBean("mapper", BookMapper.class);
        System.out.println(mapper.selectById(1));
        BookService service = ioc.getBean("service", BookService.class);
        service.queryBook();


        System.out.println("--------------------------------");
        BookMapper bookMapper1 = ioc.getBean("bookMapper2",BookMapper.class);
        BookMapper bookMapper2 = ioc.getBean("bookMapper2",BookMapper.class);
        System.out.println(bookMapper1 == bookMapper2);
        bookMapper1.selectById(1);
        bookMapper2.selectById(2);
    }
}
